package com.example.devicemanage.service.impl;

import com.example.devicemanage.dao.BreakMapper;
import com.example.devicemanage.dao.RepairMapper;
import com.example.devicemanage.entity.Break;
import com.example.devicemanage.service.inter.BreakService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BreakServiceimp implements BreakService {
    @Autowired
    BreakMapper breakMapper;
    @Override
    public Boolean saveBreak(Break b) {
        int flag=breakMapper.insertBreak(b.getEid(),b.getDate(),b.getNote());
        if(flag==1){
            return true;
        }
        else
            return false;
    }

    @Override
    public List<Break> showAllBreak() {
        return breakMapper.showAllBreak();
    }

    @Override
    public int deleteByid(int repairid) {
        return breakMapper.deleteById(repairid);
    }

    @Override
    public Boolean updateBreak(Break b) {
        breakMapper.deleteById(b.getBid());
        return  breakMapper.updateBreak(b)==1;
    }
}

